import { CollectionRecordVO } from '@/services/CollectionRecordService'
import { proxy } from '@@/exports'

interface CollectionRecordModelType {
  collectionRecord?: CollectionRecordVO
  updateModalState: boolean
}

const state = proxy<CollectionRecordModelType>({
  collectionRecord: undefined,
  updateModalState: false,
})

const actions = {
  setUpdateModalState(modalState: boolean) {
    state.updateModalState = modalState
  },

  openUpdateModal(modalState: boolean, collectionRecord?: CollectionRecordVO) {
    state.collectionRecord = collectionRecord
    state.updateModalState = modalState
  },
}

export const CollectionRecordModel = { state, actions }
